<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="vue.js"></script>
    <title>first</title>
</head>
<body>
    <!-- <div id="app">
        <my-parent name="第一个哦"></my-parent>
    </div>
    <script>
        Vue.component('my-parent',{
            props:['name'],
            template:'<div>我是父组件{{name}}</div>'
        })
        var vm= new Vue({
            el:'#app'
        })
    </script> -->


    <!-- <div id="app">
        <parent></parent>
    </div>
    <template id="child">
        <div>
            <button @click="click">Send</button>
            <input type="text" v-model="message">
        </div>
    </template>
    <script>
        Vue.component('parent',{
            template:'<div><child @childFn="transContent"></child>'+
                '子组件传来的值:{{message}}</div>',
            data(){
                return{
                    message:''
                }
            },
            methods:{
                transContent(payload){
                    this.message=payload
                }
            }
        })
        Vue.component('child',{
            template:'#child',
            data(){
                return{
                    message:'来了'
                }
            },
            methods:{
                click(){
                    this.$emit('childFn',this.message);
                }
            }
        })
        var vm=new Vue({el:'#app'})
    </script> -->


    <!-- <div id="app">{{msg}}</div>
    <script>
        var vm=new Vue({
            el:'#app',
            data:{msg:'张三'},
            beforeCreate(){
                console.log('创建实例之前')
                console.log(this.$data.msg)
            },
            created(){
                console.log('创建实例之后')
                console.log(this.$data.msg)
            }
        })
    </script> -->


    <!-- <div id="app">{{msg}}</div>
    <script>
        var vm=new Vue({
            el:'#app',
            data:{msg:'张三'},
            beforeMount(){
                console.log('挂载之前')
                console.log(this.$el.innerHTML)
            },
            mounted(){
                console.log('挂载之后')
                console.log(this.$el.innerHTML)
            }
        })
    </script> -->


    <div id="app">
        <div v-if="isShow" ref="self">111</div>
        <button @click="isShow=!isShow">更新</button>
    </div>
    <script>
        var vm=new Vue({
            el:'#app',
            data:{isShow:false},
            beforeUpdate(){
                console.log('更新之前')
                console.log(this.$refs.self)
            },
            updated(){
                console.log('更新之后')
                console.log(this.$refs.self)
            }
        })
    </script>
</body>
</html>